Method and apparatus for processing asynchronous audio stream

ABSTRACT

A method and an apparatus for processing an asynchronous audio stream are provided. A corrupted PES packet is detected from an asynchronous audio PES stream, and the ADTS frames of the corrupted PES packet are detected and replaced with predetermined substitute ADTS frames. Thus, an AAC stream is restored from the PES stream.

PRIORITY

This application claims priority under 35 U.S.C. §119 to an application entitled “Method and Apparatus for Processing Asynchronous Audio Stream” filed in the Korean Intellectual Property Office on Nov. 24, 2004 and assigned Serial No. 2004-97141, the contents of which are incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates generally to a method and apparatus for restoring an audio stream, and in particular, to a method and apparatus for storing an Advanced Audio Coding (AAC) stream from an asynchronous audio Packetized Elementary Stream (PES) stream.

2. Description of the Related Art

In satellite Digital Multimedia Broadcasting (DMB), audio data is transmitted in a predetermined transport stream on a broadcast channel which will be described with reference to FIG. 1.

Referring to FIG. 1, an AAC stream 102 is created by compressing and encoding the audio PCM (Pulse Coded Modulation) data of an audio PCM stream 100 in an MPEG-2 (Moving Picture Expert Group-2) AAC+SBR (Spectral Band Replication) CODEC (Coder-Decoder) and attaching a header to the compressed-coded audio data. The PCM stream 100 includes PCM frames each having PCM data in which 2,048 samples of data are sampled at 48 kHz. The AAC stream 102 includes Audio Data Transport Stream (ADTS) frames each having a compressed-coded PCM frame attached with an ADTS header. In FIG. 1, each ADTS header is denoted by ‘A’.

The AAC stream 102 is segmented to a predetermined size in compliance with the ISO (International Organization for Standardization)/IEC (International Organization for Standardization) 13818-1 standard, and a header 112 is attached to each segment stream 114, thereby producing PES packets. These PES packets form a PES stream 104. The PES header 112 of each PES packet is denoted by “P” in FIG. 1.

The PES stream 104 is in turn segmented to a predetermined size and a header 116 is attached to each segment stream 118, thus creating TS (Transport Stream) packets. The TS packets form a TS stream 106.

Referring back to the PES stream 104, t0 through t5 inserted at the start of the PCM frames in the PCM frame 100 are time information values indicating when the audio information is to be represented in a decoder. The time information is included in part of PES header data as time stamps.

In order to deliver as much audio data as possible in TS packets of a fixed size, the conventional satellite DMB service does not synchronize the ADTS headers of the AAC stream to the PES headers of the PES stream. As noted from FIG. 1, the ADTS header “A” does not follow the PES header “P” all the time. This method is called an asynchronous PES scheme, which offers the benefit of transmitting as much audio data as possible in TS packets.

Without processing TS packets including an error, however, the asynchronous PES scheme restores the AAC stream to the form illustrated in FIG. 2which illustrates an example of restoring a TS stream 200 to a PES stream 202 and then to an AAC stream 204 on the assumption that two TS packets 206 and 208 in the TS stream 200 are corrupted by errors. The PES stream 202 resulting from the TS stream 200 also includes corrupted PES data 210 and 212 corresponding to the TS packets 206 and 208. If the TS stream 200 does not contain any errors, the PES stream 202 can be restored similarly to the PES stream 104 illustrated in FIG. 1. But when the TS steam 200 contains errors such as those included in packets 206 and 208, the restored PES stream includes the corrupted PES data 210 and 212.

Similarly, the AAC stream 204 restored from the PES stream 202 includes corrupted data 214 and 216, unlike the AAC stream 102 illustrated in FIG. 1. The corrupted data 214 and 216 may include data field 218 corresponding to an ADTS header.

As described above, the AAC stream with corrupted data causes problems in an audio CODEC. In addition, if the data field 218 corresponding to size in the ADTS header is corrupted as illustrated in FIG. 2, the audio CODEC may experience a fatal error.

Discard of the corrupted PES data to prevent errors, causes a loss of the time information. As a result, the audio data is reproduced too fast and ADTS data with different headers are mixed in an ADTS frame, seriously affecting the audio CODEC.

SUMMARY OF THE INVENTION

Accordingly, the present invention provides an audio stream processing method and apparatus for increasing audio quality and system stability even when Packetized Elementary Stream (PES) packets are corrupted due to errors in an asynchronous audio PES stream.

Further, the present invention provides an audio stream processing method and apparatus for optimally restoring an Advanced Audio Coding (AAC) frame from a PES packet corrupted by errors in an asynchronous audio PES stream.

In addition, the present invention provides an audio stream processing method and apparatus for storing restored audio data in a syntaxically perfect structure so that stability can be ensured even when an audio stream is stored in an external device.

The above objects are achieved by providing a method and apparatus for processing an asynchronous audio stream.

In the asynchronous audio stream processing method and apparatus, a corrupted PES packet is detected from an asynchronous audio PES stream, and the ADTS frames of the corrupted PES packet are replaced with predetermined substitute ADTS frames. Thus, an AAC stream is restored from the PES stream.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other objects, features and advantages of the present invention will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings in which:

FIG. 1 is a diagram illustrating an example of an audio stream configuration in a satellite DMB service;

FIG. 2 is a diagram illustrating an example of a restored AAC stream including packets having corrupted data;

FIG. 3 is a block diagram of an audio stream processor according to an embodiment of the present invention;

FIG. 4 is a flowchart illustrating an operation for processing asynchronous audio PES data according to an embodiment of the present invention; and

FIG. 5 is a diagram illustrating an AAC stream restoration according to an embodiment of the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Preferred embodiments of the present invention will be described herein below with reference to the accompanying drawings. In the following description, well-known functions or constructions are not described in detail since they would obscure the invention in unnecessary detail.

FIG. 3 is a block diagram of an audio stream processor according to an embodiment of the present invention. The audio stream processor includes an AAC stream restorer 302, a system audio stream generator 304 and a ring buffer 306. A TS demultiplexer (DEMUX) 300 restores a PES stream from a TS stream. The PES stream may have corrupted data (e.g., data including errors, etc.). The AAC stream restorer 302 restores an AAC stream from the PES stream. In the presence of a corrupted PES packet, the AAC stream restorer 302 restores the AAC stream according to a syntax (which will be described below) by processing the corrupted PES data.

The PES data processing of the AAC stream restorer 302 will be described below with reference to FIGS. 4 and 5. FIG. 4 is a flowchart illustrating an operation for processing asynchronous audio PES data according to an embodiment of the present invention. The asynchronous audio PES data is processed by the AAC stream restorer 302 in step 400 through step 426. FIG. 5 is a diagram illustrating restoration of a normal AAC stream 500 rather than the corrupted AAC stream 204 from the PES stream 202.

Referring to FIG. 4, the AAC stream restorer 302 receives PES data from the TS DEMUX 300 in step 400 and determines whether the PES data is a corrupted PES packet in step 402. If it is determined that the PES data includes a corrupted PES packet, the AAC stream restorer 302 discards the corrupted PES packet in step 404 and returns to step 400.

On the other hand, if it is determined that the PES data includes a normal PES packet and does not contain a corrupted PES packet, the AAC stream restorer 302 acquires a time stamp from the current PES packet in step 406 and searches for the first ADTS header from the current PES packet in step 408. If a current PES includes a prefix frame the prefix frame (e.g., prefix frame 506) is temporarily stored in step 408. The prefix frame is then used for restoring an ADTS frame from the current PES packet. In step 41 0, it is determined whether the current PES packet has a residual frame.

The prefix frame is more clearly illustrated with reference to FIG. 5 wherein reference numeral 506 denotes a prefix frame and reference numeral 504 denotes a residual frame. The prefix frame 506 refers to a segmented ADTS frame existing between the PES header P and the first ADTS header A in the current PES packet. The residual frame 504 refers to a segmented ADTS frame following the end of the previous normal PES packet. The residual frame 504 and the prefix frame 506 are created in the case where one ADTS frame is segmented over two PES packets when producing a PES stream from an AAC frame. If the current PES frame includes the residual frame 504, the residual frame is stored in step 424 and used for restoring an ADTS frame from the next PES packet.

Referring back to FIG. 4,in step 410, if it is determined that the PES data includes a residual frame, the residual frame is merged with the prefix frame and the merged frame is stored in step 418. As illustrated with reference to FIG. 5, the AAC stream 500 includes a residual frame 508 and a prefix frame 510 corresponding to the residual stream 504 and the prefix frame 506 of the PES stream 202 all of which are merged into a single ADTS frame.

In the absence of a residual frame in step 410, it is determined whether the current PES packet is the first one in step 412. That is, the AAC stream restorer 302 determines whether the current PES packet is the first packet of the PES stream, that is, the first received PES packet in DMB reception, for example.

If the PES packet is not the first packet of the PES stream, the AAC stream restorer 302 counts the number of lost ADTS frames in step 414. The number of lost ADTS frames is the number of ADTS frames in the corrupted PES packet between the previous normal PES packet and the current PES packet. The number and positions of deleted ADTS frames are known by the time stamps of the PES packets preceding and following the corrupted PES packet. That is, since a time interval per ADTS frame is known by the sampling frequency of the audio signal, the number of ADTS frames in the corrupted PES packet is calculated using the time stamps of the headers of the normal PES packets.

If the previous PES packet is corrupted and the current PES packet is a normal PES packet following the corrupted PES packet, the time stamp of the current PES packet (acquired in step 406) is stored in step 426 so that if the next PES packet is corrupted, the time stamp can be used in restoring a lost ADTS frame during processing the PES packet following the next PES packet.

An equal number of lost ADTS frames as was calculated in step 414 are replaced with predetermined ADTS frames and then the predetermined ADTS frames stored in step 416. The replacement can be performed in many ways. For example, an ADTS frame wherein mute is compressed is pre-stored and then, a lost ADTS frame can be replaced with the pre-stored ADTS frame. In addition, an ADTS frame wherein white noise is compressed is pre-stored and then, a lost ADTS frame can be replaced with the pre-stored ADTS frame. Or a normal ADTS frame restored from a normal PES packet preceding a corrupted PES packet is stored and then substituted for a lost ADTS frame.

In the case where one or two frames of ADTS data are corrupted, they are replaced by the previous normal ADTS frame. If consecutive ADTS frames are corrupted, they can be replaced with mute-compressed ADTS frames or white noise-compressed ADTS frames. In this case, since the difference between the audio data of a lost ADTS frame and the audio data of the previous normal ADTS frame may be very wide, it is preferable to replace the lost ADTS frame with the mute-compressed or white noise-compressed ADTS frame. Mute-compressed ADTS frames are ADTS frames wherein mute is compressed. Likewise, white noise-compressed ADTS frames are ADTS frames wherein white noise is compressed.

After calculating the number of ADTS frames in the corrupted PES packet and the current PES packet in step 420, the ACC stream restorer 302 stores as many ADTS frames as calculated, in step 422. The ADTS frames of the corrupted PES packet are replaced with the above-described substitute ADTS frames and the ADTS frames of the current PES packet are stored normally.

The residual frame and the time stamp of the current PES packet are stored in steps 424 and 426, for use in restoring lost ADTS frames during processing a normal PES packet following the next PES packet which is corrupted. The ACC stream restorer 302 then returns to step 400, for processing the next PES packet.

In this way, the ADTS frames within a PES packet are restored without errors and lost ADTS frames are appropriately replaced.

Referring back to FIG. 3, the restored AAC stream is provided to the system audio stream generator 304. The system audio stream generator 304 generates a system audio stream 502 by attaching a header H to each ADTS frame of the AAC stream, as illustrated in FIG. 5, and stores the system audio stream 502 in the ring buffer 306. The header H includes time information. The system audio stream generator 304 can include the original time information t0 through t5 (illustrated in FIG. 1) in the system audio stream 502 using time information based on the time stamps of normal PES packets before and after a corrupted PES packet.

As the system audio stream 502 is stored in the ring buffer 306, the frames of the system audio stream are cyclically stored and read. Thus, despite the time delay involved in restoring lost ADTS frames in the AAC stream restorer 302, that is, the time delay of ADTS frame output until a normal PES packet follows a corrupted PES packet, the system audio stream can be normally output through buffering. The system audio stream stored in the ring buffer can be reproduced in an audio CODEC 308 or recorded in a recorder 310.

As described above, the present invention restores ADTS frames from a PES packet without syntax errors and replaces lost ADTS frames appropriately. Therefore, audio noise caused by errors created either before and/or during the transmission of satellite DMB broadcasting can be reduced or entirely eliminated and the stability of a CODEC and a corresponding system enhanced.

Furthermore, when broadcasting is recorded in an error environment, it can be stored in files free of syntax errors. Therefore, stability is provided to the system when the recorded audio data is reproduced.

While the invention has been shown and described with reference to certain preferred embodiments thereof, they are merely an exemplary embodiments. While the embodiments of the present invention have been described in the context of a satellite DMB, the present invention is also applicable to other systems capable of processing asynchronous audio PES streams. Thus, it will be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the spirit and scope of the invention as defined by the appended claims. 

1. A method of restoring an Advanced Audio Coding (AAC) stream from an asynchronous audio Packetized Elementary Stream (PES) stream, comprising the steps of: detecting a corrupted PES packet among PES packets of the PES stream; and restoring the AAC stream by replacing each Audio Data Transport Stream (ADTS) frame within the corrupted PES packet with a corresponding predetermined substitute ADTS frame.
 2. The method of claim 1, wherein the restoring step comprises the steps of: discarding the corrupted PES packet; counting the number of lost ADTS frames by the corrupted PES packet based on a time stamp included in a normal PES packet preceding the corrupted PES packet and a time stamp included in a normal PES packet following the corrupted PES packet; and replacing each of the lost ADTS frames with the substitute ADTS frame.
 3. The method of claim 1, wherein the substitute ADTS frame is one of a mute-compressed ADTS frame and a white noise-compressed ADTS frame.
 4. The method of claim 2, wherein the substitute ADTS frame is one of a mute-compressed ADTS frame and a white noise-compressed ADTS frame.
 5. The method of claim 1, wherein the substitute ADTS frame is one of a mute-compressed ADTS frame, a white noise-compressed ADTS frame and a normal ADTS frame restored from a normal PES packet adjacent to the corrupted PES packet.
 6. The method of claim 2, wherein the substitute ADTS frame is one of a mute-compressed ADTS frame, a white noise-compressed ADTS frame and a normal ADTS frame restored from a normal PES packet adjacent to the corrupted PES packet.
 7. The method of claim 5, wherein the replacing step comprises: replacing each of the lost ADTS frames with a predetermined one of the mute-compressed ADTS frame and the white noise-compressed ADTS frame, if the number of the lost ADTS frames is greater than a predetermined value; and replacing each of the lost ADTS frames with the normal ADTS frame, if the number of the lost ADTS frames is equal to or less than the predetermined value.
 8. An apparatus for processing an asynchronous audio Packetized Elementary Stream (PES) stream, comprising: an Advanced Audio Coding (AAC) stream restorer for restoring an AAC stream by replacing each Audio Data Transport Stream (ADTS) frame of a corrupted PES packet in the PES stream with a predetermined substitute ADTS frame; a system audio stream generator for generating a system audio stream by attaching a header including time information to each ADTS frame of the restored AAC stream; and a ring buffer for buffering the system audio stream.
 9. The apparatus of claim 8, wherein the AAC stream restorer counts the number of lost ADTS frames by the corrupted PES packet based on a time stamp included in a normal PES packet preceding the corrupted PES packet and a time stamp included in a normal PES packet following the corrupted PES packet, and replaces each of the lost ADTS frames with a substitute ADTS frame.
 10. The apparatus of claim 8, wherein the substitute ADTS frame is one of a mute-compressed ADTS frame and a white noise-compressed ADTS frame.
 11. The apparatus of claim 9, wherein the substitute ADTS frame is one of a mute-compressed ADTS frame and a white noise-compressed ADTS frame.
 12. The apparatus of claim 8, wherein the substitute ADTS frame is one of a mute-compressed ADTS frame, a white noise-compressed ADTS frame and a normal ADTS frame restored from a normal PES packet adjacent to the corrupted PES packet.
 13. The apparatus of claim 9, wherein the substitute ADTS frame is one of a mute-compressed ADTS frame, a white noise-compressed ADTS frame and a normal ADTS frame restored from a normal PES packet adjacent to the corrupted PES packet.
 14. The apparatus of claim 12, wherein the AAC stream restorer: replaces each of the lost ADTS frames with a predetermined one of the mute-compressed ADTS frame and the white noise-compressed ADTS frame, if the number of the lost ADTS frames is greater than a predetermined value, and replaces each of the lost ADTS frames with the normal ADTS frame, if the number of the lost ADTS frames is equal to or less than the predetermined value.
 15. The apparatus of claim 13, wherein the AAC stream restorer: replaces each of the lost ADTS frames with a predetermined one of the mute-compressed ADTS frame and the white noise-compressed ADTS frame, if the number of the lost ADTS frames is greater than a predetermined value, and replaces each of the lost ADTS frames with the normal ADTS frame, if the number of the lost ADTS frames is equal to or less than the predetermined value. 